﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using System.IO;
using CompileEffect;
using XnaColor = Microsoft.Xna.Framework.Color;
using System.Collections;
namespace Candy
{
    public class EffectMgr
    {
        KGFramework CandyGame = null;
        public Effect CurEffect = null;
        Matrix WorldMartix;
        public EffectMgr(KGFramework game)
        {
            CandyGame = game;

            CurEffect = new Effect(
                CandyGame.GraphicsDevice,
                EffectReader.GetEffect(".\\Shader.hlsl", CandyGame.GraphicsDevice.GraphicsProfile));

            ResetMartix(1.0f);
            CurEffect.Parameters["Width"].SetValue(Global.Width);
            CurEffect.Parameters["Height"].SetValue(Global.Height);
        }

        public void ResetMartix(float n)
        {
            WorldMartix = Matrix.CreateOrthographicOffCenter(0.0f, n * Global.Width, n * Global.Height, 0.0f, -3.0f, -1.0f);
            CurEffect.Parameters["martix"].SetValue(WorldMartix);
        }
    }
}
